package creator.factory.factoryMethod;


/**
 * 甜品店
 * 缺点：咖啡店和甜品店都对咖啡强耦合，如果咖啡店和甜品店有新的咖啡，那么咖啡店和甜品店都要修改代码
 */
public class DessertStore {

    private CoffeeFactory factory;

    public void setFactory(CoffeeFactory factory) {
        this.factory = factory;
    }

    //点咖啡功能
    public Coffee orderCoffee() {
        Coffee coffee = factory.createCoffee();
        //加配料
        coffee.addMilk();
        coffee.addsugar();
        return coffee;
    }
}
